﻿package com.element 
{
	import com.utils.DebugTrace;
	import com.utils.SWFLoader;
	import flash.display.Sprite;
	import flash.events.Event;
	
	/**
	 * ...
	 * @author zhengzihua
	 */
	public class Shop extends Sprite
	{
		private var shopLoader:SWFLoader;
		private static var instance:Shop;
		public function Shop(singletonEnforce:SingletonEnforceShop) 
		{
			init();
		}
		public static function getInstance():Shop {
			if (instance == null) {
				instance = new Shop(new SingletonEnforceShop());	
			}else {
				DebugTrace.dtrace("code info Shop.as:商店已经被实例化了.");
			}
			return instance;
		}
		private function init():void {
			shopLoader = new SWFLoader();
			shopLoader.Load("lib_shop.swf", "child");
			shopLoader.addEventListener(Event.COMPLETE, onComplete);
		}
		
		private function onComplete(e:Event):void 
		{
			layOut();
		}
		private function layOut():void {
			trace("这是一个商店");
		}
		
	}
	
}
class SingletonEnforceShop{}